package mspbots.hubspot.client.mailchimp.client;

import org.springframework.stereotype.Service;
import org.springframework.util.Base64Utils;
import org.springframework.web.reactive.function.client.WebClient;

/**
 * data.connector.hubspot.client.MailChimpClient
 *
 * @author Alex bob(https://github.com/vnobo)
 * @date Created by 2020/4/8
 */
@Service
public class MailChimpClient extends BaseClient {

    public MailChimpClient(WebClient.Builder builder, ChimpProperties clientProperties) {
        super(builder.baseUrl(clientProperties.getSite())
                .defaultHeader("Authorization", "Basic " +
                        Base64Utils.encodeToString(("mspbots:" + clientProperties.getToken()).getBytes()))
                .defaultHeader("Accept", "application/json")
                .build());
    }
}
